package com.ruoyi.system.provider;

import com.ruoyi.system.domain.TbAppVersion;
import org.apache.ibatis.jdbc.SQL;

public class TbAppVersionSqlProvider {

    public String insertSelective(TbAppVersion record) {
        SQL sql = new SQL();
        sql.INSERT_INTO("tb_app_version");
        
        if (record.getPackageId() != null) {
            sql.VALUES("package_id", "#{packageId,jdbcType=BIGINT}");
        }
        
        if (record.getPackageName() != null) {
            sql.VALUES("package_name", "#{packageName,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageVersioncode() != null) {
            sql.VALUES("package_versioncode", "#{packageVersioncode,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageVersionnumber() != null) {
            sql.VALUES("package_versionnumber", "#{packageVersionnumber,jdbcType=INTEGER}");
        }
        
        if (record.getPackageSize() != null) {
            sql.VALUES("package_size", "#{packageSize,jdbcType=DOUBLE}");
        }
        
        if (record.getOsRequirement() != null) {
            sql.VALUES("os_requirement", "#{osRequirement,jdbcType=VARCHAR}");
        }
        
        if (record.getSdkRequirement() != null) {
            sql.VALUES("sdk_requirement", "#{sdkRequirement,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageHash() != null) {
            sql.VALUES("package_hash", "#{packageHash,jdbcType=VARCHAR}");
        }
        
        if (record.getRemark() != null) {
            sql.VALUES("remark", "#{remark,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getPublishDate() != null) {
            sql.VALUES("publish_date", "#{publishDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getPackageType() != null) {
            sql.VALUES("package_type", "#{packageType,jdbcType=INTEGER}");
        }
        
        if (record.getPackageUrl() != null) {
            sql.VALUES("package_url", "#{packageUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.VALUES("status", "#{status,jdbcType=INTEGER}");
        }
        
        if (record.getDownloadCount() != null) {
            sql.VALUES("download_count", "#{downloadCount,jdbcType=INTEGER}");
        }
        
        if (record.getIsForceUpdate() != null) {
            sql.VALUES("is_force_update", "#{isForceUpdate,jdbcType=INTEGER}");
        }
        
        if (record.getCreateBy() != null) {
            sql.VALUES("create_by", "#{createBy,jdbcType=VARCHAR}");
        }
        
        if (record.getCreateTime() != null) {
            sql.VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.VALUES("update_by", "#{updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.VALUES("update_time", "#{updateTime,jdbcType=TIMESTAMP}");
        }
        
        return sql.toString();
    }

    public String updateByPrimaryKeySelective(TbAppVersion record) {
        SQL sql = new SQL();
        sql.UPDATE("tb_app_version");
        
        if (record.getPackageId() != null) {
            sql.SET("package_id = #{packageId,jdbcType=BIGINT}");
        }
        
        if (record.getPackageName() != null) {
            sql.SET("package_name = #{packageName,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageVersioncode() != null) {
            sql.SET("package_versioncode = #{packageVersioncode,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageVersionnumber() != null) {
            sql.SET("package_versionnumber = #{packageVersionnumber,jdbcType=INTEGER}");
        }
        
        if (record.getPackageSize() != null) {
            sql.SET("package_size = #{packageSize,jdbcType=DOUBLE}");
        }
        
        if (record.getOsRequirement() != null) {
            sql.SET("os_requirement = #{osRequirement,jdbcType=VARCHAR}");
        }
        
        if (record.getSdkRequirement() != null) {
            sql.SET("sdk_requirement = #{sdkRequirement,jdbcType=VARCHAR}");
        }
        
        if (record.getPackageHash() != null) {
            sql.SET("package_hash = #{packageHash,jdbcType=VARCHAR}");
        }
        
        if (record.getRemark() != null) {
            sql.SET("remark = #{remark,jdbcType=LONGVARCHAR}");
        }
        
        if (record.getPublishDate() != null) {
            sql.SET("publish_date = #{publishDate,jdbcType=TIMESTAMP}");
        }
        
        if (record.getPackageType() != null) {
            sql.SET("package_type = #{packageType,jdbcType=INTEGER}");
        }
        
        if (record.getPackageUrl() != null) {
            sql.SET("package_url = #{packageUrl,jdbcType=VARCHAR}");
        }
        
        if (record.getStatus() != null) {
            sql.SET("status = #{status,jdbcType=INTEGER}");
        }
        
        if (record.getDownloadCount() != null) {
            sql.SET("download_count = #{downloadCount,jdbcType=INTEGER}");
        }
        
        if (record.getIsForceUpdate() != null) {
            sql.SET("is_force_update = #{isForceUpdate,jdbcType=INTEGER}");
        }
        
        if (record.getUpdateBy() != null) {
            sql.SET("update_by = #{updateBy,jdbcType=VARCHAR}");
        }
        
        if (record.getUpdateTime() != null) {
            sql.SET("update_time = #{updateTime,jdbcType=TIMESTAMP}");
        }
        
        sql.WHERE("id = #{id,jdbcType=BIGINT}");
        
        return sql.toString();
    }
}